import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/currency_search_entity.dart';

CurrencySearchEntity $CurrencySearchEntityFromJson(Map<String, dynamic> json) {
  final CurrencySearchEntity currencySearchEntity = CurrencySearchEntity();
  final List<CurrencySearchList>? list = (json['list'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<CurrencySearchList>(e) as CurrencySearchList)
      .toList();
  if (list != null) {
    currencySearchEntity.list = list;
  }
  return currencySearchEntity;
}

Map<String, dynamic> $CurrencySearchEntityToJson(CurrencySearchEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['list'] = entity.list?.map((v) => v.toJson()).toList();
  return data;
}

extension CurrencySearchEntityExt on CurrencySearchEntity {
  CurrencySearchEntity copyWith({
    List<CurrencySearchList>? list,
  }) {
    return CurrencySearchEntity()
      ..list = list ?? this.list;
  }
}

CurrencySearchList $CurrencySearchListFromJson(Map<String, dynamic> json) {
  final CurrencySearchList currencySearchList = CurrencySearchList();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    currencySearchList.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    currencySearchList.name = name;
  }
  final String? symbol = jsonConvert.convert<String>(json['symbol']);
  if (symbol != null) {
    currencySearchList.symbol = symbol;
  }
  final String? mytokenId = jsonConvert.convert<String>(json['mytoken_id']);
  if (mytokenId != null) {
    currencySearchList.mytokenId = mytokenId;
  }
  final String? cmcId = jsonConvert.convert<String>(json['cmc_id']);
  if (cmcId != null) {
    currencySearchList.cmcId = cmcId;
  }
  final String? cmcUrl = jsonConvert.convert<String>(json['cmc_url']);
  if (cmcUrl != null) {
    currencySearchList.cmcUrl = cmcUrl;
  }
  final String? contractAddress = jsonConvert.convert<String>(
      json['contract_address']);
  if (contractAddress != null) {
    currencySearchList.contractAddress = contractAddress;
  }
  final String? logo = jsonConvert.convert<String>(json['logo']);
  if (logo != null) {
    currencySearchList.logo = logo;
  }
  final String? website = jsonConvert.convert<String>(json['website']);
  if (website != null) {
    currencySearchList.website = website;
  }
  final String? explorer = jsonConvert.convert<String>(json['explorer']);
  if (explorer != null) {
    currencySearchList.explorer = explorer;
  }
  final String? announcement = jsonConvert.convert<String>(
      json['announcement']);
  if (announcement != null) {
    currencySearchList.announcement = announcement;
  }
  final String? messageBoard = jsonConvert.convert<String>(
      json['message_board']);
  if (messageBoard != null) {
    currencySearchList.messageBoard = messageBoard;
  }
  final int? rank = jsonConvert.convert<int>(json['rank']);
  if (rank != null) {
    currencySearchList.rank = rank;
  }
  final String? priceUsd = jsonConvert.convert<String>(json['price_usd']);
  if (priceUsd != null) {
    currencySearchList.priceUsd = priceUsd;
  }
  final String? priceCny = jsonConvert.convert<String>(json['price_cny']);
  if (priceCny != null) {
    currencySearchList.priceCny = priceCny;
  }
  final String? priceBtc = jsonConvert.convert<String>(json['price_btc']);
  if (priceBtc != null) {
    currencySearchList.priceBtc = priceBtc;
  }
  final String? volumeUsd24h = jsonConvert.convert<String>(
      json['volume_usd_24h']);
  if (volumeUsd24h != null) {
    currencySearchList.volumeUsd24h = volumeUsd24h;
  }
  final String? marketCapUsd = jsonConvert.convert<String>(
      json['market_cap_usd']);
  if (marketCapUsd != null) {
    currencySearchList.marketCapUsd = marketCapUsd;
  }
  final int? availableSupply = jsonConvert.convert<int>(
      json['available_supply']);
  if (availableSupply != null) {
    currencySearchList.availableSupply = availableSupply;
  }
  final int? totalSupply = jsonConvert.convert<int>(json['total_supply']);
  if (totalSupply != null) {
    currencySearchList.totalSupply = totalSupply;
  }
  final int? maxSupply = jsonConvert.convert<int>(json['max_supply']);
  if (maxSupply != null) {
    currencySearchList.maxSupply = maxSupply;
  }
  final double? percentChange1h = jsonConvert.convert<double>(
      json['percent_change_1h']);
  if (percentChange1h != null) {
    currencySearchList.percentChange1h = percentChange1h;
  }
  final double? percentChange24h = jsonConvert.convert<double>(
      json['percent_change_24h']);
  if (percentChange24h != null) {
    currencySearchList.percentChange24h = percentChange24h;
  }
  final double? percentChange7d = jsonConvert.convert<double>(
      json['percent_change_7d']);
  if (percentChange7d != null) {
    currencySearchList.percentChange7d = percentChange7d;
  }
  final String? searchField = jsonConvert.convert<String>(json['search_field']);
  if (searchField != null) {
    currencySearchList.searchField = searchField;
  }
  final int? enabled = jsonConvert.convert<int>(json['enabled']);
  if (enabled != null) {
    currencySearchList.enabled = enabled;
  }
  final String? alias = jsonConvert.convert<String>(json['alias']);
  if (alias != null) {
    currencySearchList.alias = alias;
  }
  final String? wallet = jsonConvert.convert<String>(json['wallet']);
  if (wallet != null) {
    currencySearchList.wallet = wallet;
  }
  final int? dcType = jsonConvert.convert<int>(json['dc_type']);
  if (dcType != null) {
    currencySearchList.dcType = dcType;
  }
  final int? currencyLevel = jsonConvert.convert<int>(json['currency_level']);
  if (currencyLevel != null) {
    currencySearchList.currencyLevel = currencyLevel;
  }
  final int? isCanRank = jsonConvert.convert<int>(json['is_can_rank']);
  if (isCanRank != null) {
    currencySearchList.isCanRank = isCanRank;
  }
  final String? marketValueIndex = jsonConvert.convert<String>(
      json['market_value_index']);
  if (marketValueIndex != null) {
    currencySearchList.marketValueIndex = marketValueIndex;
  }
  final String? currencyCompositeIndex = jsonConvert.convert<String>(
      json['currency_composite_index']);
  if (currencyCompositeIndex != null) {
    currencySearchList.currencyCompositeIndex = currencyCompositeIndex;
  }
  final String? marketConcertIndex = jsonConvert.convert<String>(
      json['market_concert_index']);
  if (marketConcertIndex != null) {
    currencySearchList.marketConcertIndex = marketConcertIndex;
  }
  final String? searchNewsKeywords = jsonConvert.convert<String>(
      json['search_news_keywords']);
  if (searchNewsKeywords != null) {
    currencySearchList.searchNewsKeywords = searchNewsKeywords;
  }
  return currencySearchList;
}

Map<String, dynamic> $CurrencySearchListToJson(CurrencySearchList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['symbol'] = entity.symbol;
  data['mytoken_id'] = entity.mytokenId;
  data['cmc_id'] = entity.cmcId;
  data['cmc_url'] = entity.cmcUrl;
  data['contract_address'] = entity.contractAddress;
  data['logo'] = entity.logo;
  data['website'] = entity.website;
  data['explorer'] = entity.explorer;
  data['announcement'] = entity.announcement;
  data['message_board'] = entity.messageBoard;
  data['rank'] = entity.rank;
  data['price_usd'] = entity.priceUsd;
  data['price_cny'] = entity.priceCny;
  data['price_btc'] = entity.priceBtc;
  data['volume_usd_24h'] = entity.volumeUsd24h;
  data['market_cap_usd'] = entity.marketCapUsd;
  data['available_supply'] = entity.availableSupply;
  data['total_supply'] = entity.totalSupply;
  data['max_supply'] = entity.maxSupply;
  data['percent_change_1h'] = entity.percentChange1h;
  data['percent_change_24h'] = entity.percentChange24h;
  data['percent_change_7d'] = entity.percentChange7d;
  data['search_field'] = entity.searchField;
  data['enabled'] = entity.enabled;
  data['alias'] = entity.alias;
  data['wallet'] = entity.wallet;
  data['dc_type'] = entity.dcType;
  data['currency_level'] = entity.currencyLevel;
  data['is_can_rank'] = entity.isCanRank;
  data['market_value_index'] = entity.marketValueIndex;
  data['currency_composite_index'] = entity.currencyCompositeIndex;
  data['market_concert_index'] = entity.marketConcertIndex;
  data['search_news_keywords'] = entity.searchNewsKeywords;
  return data;
}

extension CurrencySearchListExt on CurrencySearchList {
  CurrencySearchList copyWith({
    int? id,
    String? name,
    String? symbol,
    String? mytokenId,
    String? cmcId,
    String? cmcUrl,
    String? contractAddress,
    String? logo,
    String? website,
    String? explorer,
    String? announcement,
    String? messageBoard,
    int? rank,
    String? priceUsd,
    String? priceCny,
    String? priceBtc,
    String? volumeUsd24h,
    String? marketCapUsd,
    int? availableSupply,
    int? totalSupply,
    int? maxSupply,
    double? percentChange1h,
    double? percentChange24h,
    double? percentChange7d,
    String? searchField,
    int? enabled,
    String? alias,
    String? wallet,
    int? dcType,
    int? currencyLevel,
    int? isCanRank,
    String? marketValueIndex,
    String? currencyCompositeIndex,
    String? marketConcertIndex,
    String? searchNewsKeywords,
  }) {
    return CurrencySearchList()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..symbol = symbol ?? this.symbol
      ..mytokenId = mytokenId ?? this.mytokenId
      ..cmcId = cmcId ?? this.cmcId
      ..cmcUrl = cmcUrl ?? this.cmcUrl
      ..contractAddress = contractAddress ?? this.contractAddress
      ..logo = logo ?? this.logo
      ..website = website ?? this.website
      ..explorer = explorer ?? this.explorer
      ..announcement = announcement ?? this.announcement
      ..messageBoard = messageBoard ?? this.messageBoard
      ..rank = rank ?? this.rank
      ..priceUsd = priceUsd ?? this.priceUsd
      ..priceCny = priceCny ?? this.priceCny
      ..priceBtc = priceBtc ?? this.priceBtc
      ..volumeUsd24h = volumeUsd24h ?? this.volumeUsd24h
      ..marketCapUsd = marketCapUsd ?? this.marketCapUsd
      ..availableSupply = availableSupply ?? this.availableSupply
      ..totalSupply = totalSupply ?? this.totalSupply
      ..maxSupply = maxSupply ?? this.maxSupply
      ..percentChange1h = percentChange1h ?? this.percentChange1h
      ..percentChange24h = percentChange24h ?? this.percentChange24h
      ..percentChange7d = percentChange7d ?? this.percentChange7d
      ..searchField = searchField ?? this.searchField
      ..enabled = enabled ?? this.enabled
      ..alias = alias ?? this.alias
      ..wallet = wallet ?? this.wallet
      ..dcType = dcType ?? this.dcType
      ..currencyLevel = currencyLevel ?? this.currencyLevel
      ..isCanRank = isCanRank ?? this.isCanRank
      ..marketValueIndex = marketValueIndex ?? this.marketValueIndex
      ..currencyCompositeIndex = currencyCompositeIndex ??
          this.currencyCompositeIndex
      ..marketConcertIndex = marketConcertIndex ?? this.marketConcertIndex
      ..searchNewsKeywords = searchNewsKeywords ?? this.searchNewsKeywords;
  }
}